<?php
/** @see Zend_Controller_Action **/
require_once 'Zend/Controller/Action.php';

class IndexController extends Zend_Controller_Action
{
	public function indexAction()
	{
	}

	public function commentAction()
	{
		$form = $this->_getCommentForm();
		
		if ($this->getRequest()->isPost()){
			if ($form->isValid($_POST)) {
				$comment = $form->getValue('comment');
				$this->view->comment = $comment;
			}
		}
		
		$this->view->form = $form;
	}
	
	/**
	* This function returns a simple form of adding a comment
	*/
	protected function _getCommentForm()
	{
		$form = new Zend_Form(array(
			'method' => 'post',
			'elements' => array(
				'comment' => array('textarea', array(
					'require' => true,
					'label' => 'Please comment:'
					)
				),
			'submit' => array('submit', array(
					'lable' => 'Add comment'
					)
				)
			)
		));
		return $form;	
	}
	
}
